*******************************************************************************
* Specify city and years
*******************************************************************************

local city = "east_baton_rouge"

use dataset_`city'_cross_pres, clear

local y1 2012
local y2 2016
local y3 2020

*******************************************************************************
* Ref support and percent black
*******************************************************************************

foreach year in `y1' `y2' `y3' {
	
	#delimit;
	
	gr tw
		(sc pctdem pctnhblack if year == `year' [aw=totalvotes], 
			msym(Oh) msize(tiny) col(gray))
		(lpoly pctdem pctnhblack if year == `year' [aw=totalvotes], 
			lcol(black) lwid(thick))
		,
			legend(off)
			plotregion(style(none))
			ylab(, angle(horiz))
			name(g`year', replace)
			title(`year')
			xtitle("")
			ytitle("")
			scale(2)
			;
			
	#delimit cr
	
	gr close
	
}

gr combine g`y1' g`y2' g`y3', rows(1) xsize(3) ysize(1) ycommon xcommon ///
	b1title("Share Black", size(vlarge)) ///
	l1title("Share Democratic Vote", size(vlarge)) ///
	imargin(zero)
	
gr export "_output/figure A17 a.pdf", replace

*******************************************************************************
* Ref support and miles from shooting
*******************************************************************************
foreach year in `y1' `y2' `y3' {
	
	#delimit;
	
	gr tw
		(sc pctdem distance if year == `year' [aw=totalvotes], 
			msym(Oh) msize(tiny) col(gray))
		(lpoly pctdem distance if year == `year' [aw=totalvotes], 
			lcol(black) lwid(thick))
		,
			legend(off)
			plotregion(style(none))
			ylab(, angle(horiz))
			name(g`year', replace)
			title(`year')
			xtitle("")
			ytitle("")
			scale(2)
			xscale(reverse)
			;
			
	#delimit cr
	
	gr close
	
}

gr combine g`y1' g`y2' g`y3', rows(1) xsize(3) ysize(1) ycommon xcommon ///
	b1title("Distance to Shooting (Miles)", size(vlarge)) ///
	l1title("Share Democratic Vote", size(vlarge)) ///
	imargin(zero)
	
gr export "_output/figure A17 b.pdf", replace

*******************************************************************************
* End
*******************************************************************************
